<template>
  <el-container>
    <el-page-header @back="goBack" :content = "buttonTitle"></el-page-header>
    <div>
      <el-popconfirm
        confirmButtonText='好的'
        cancelButtonText='不用了'
        icon="el-icon-info"
        iconColor="red"
        title="这是一段内容确定删除吗？"
        @Confirm = "ss1"
        @Cancel = "ss2"
      >
      <template #reference>
        <el-badge :value="buttonvalue" class="item">
          <el-button type="success">提示按钮</el-button>
        </el-badge>
        </template>
      </el-popconfirm>
    </div>
    
    <!-- <el-row>{{buttonTitle}}</el-row> -->
    <el-header align>
      <el-row align>
        <!-- <el-button type="success" round @click="toMenu('/Main/button', $event)">各种按钮</el-button>
        <el-button type="success" round @click="toMenu('/Main/Container', $event)">布局</el-button>
        <el-button type="success" round @click="toMenu('/Main/NavMenu', $event)">下拉菜单</el-button>
        <el-button type="success" round @click="toMenu('/Main/aa', $event)">aa</el-button>
        <el-button type="success" round @click="toMenu('/Main/bb', $event)">bb</el-button> -->
        <el-menu
          :default-active="activeIndex2"
          class="el-menu-demo"
          mode="horizontal"
          @select="handleSelect"
          background-color="#545c64"
          text-color="#fff"
          active-text-color="#ffd04b">
          <el-menu-item index="1" @click="toMenu('/Main/button', $event)">各种按钮</el-menu-item>
          <el-submenu index="2">
            <template #title>菜单</template>
            <el-menu-item index="2-1" @click="toMenu('/Main/NavMenu', $event)">NavMenu</el-menu-item>
            <el-menu-item index="2-2" @click="toMenu('/Main/aa', $event)">aa</el-menu-item>
            <el-menu-item index="2-3" @click="toMenu('/Main/bb', $event)">bb</el-menu-item>
            <!-- <el-submenu index="2-4">
              <template #title>选项4</template>
              <el-menu-item index="2-4-1">选项1</el-menu-item>
              <el-menu-item index="2-4-2">选项2</el-menu-item>
              <el-menu-item index="2-4-3">选项3</el-menu-item>
            </el-submenu> -->
          </el-submenu>
          <el-menu-item index="3" @click="toMenu('/Main/Container', $event)">布局</el-menu-item>
          <el-menu-item index="3" @click="toMenu('/Main/Step', $event)">进度条</el-menu-item>

            

          <el-menu-item index="4"><a href="https://www.ele.me" target="_blank">订单管理</a></el-menu-item>
        
        </el-menu>
      </el-row>
    </el-header>
    <el-main>
      <router-view/>
    </el-main>
  </el-container>

</template>

<script>

export default {
  name: 'Main',
  props: {
    msg: String
  },
  methods:{
    toMenu(url, el) {
      console.log(el)
      // this.buttonTitle = el.currentTarget.innerText
      this.$router.push(url)
    },
    goBack() {
      this.$router.go(-1)
    },
    
    handleSelect(key, keyPath) {
      console.log(key, keyPath);
    },
    ss1(){
      console.log('ss1')
      this.buttonvalue++
    },
    ss2(){
      console.log('ss2')
      this.buttonvalue--
    }
    
  },
  data() {
    return {
      // activeIndex: '1',
      activeIndex2: '1',
      buttonTitle : '未选择',
      buttonvalue: 5
    }
  }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style>
  
  .el-row {
    margin-bottom: 20px;
    /* line-height: px; */
    /* background-color: aliceblue; */
  }
  .last-child {
    margin-bottom: 0;
  }
  
  .el-col {
    border-radius: 4px;
  }
  .bg-purple-dark {
    background: #99a9bf;
  }
  .bg-purple {
    background: #d3dce6;
  }
  .bg-purple-light {
    background: #e5e9f2;
  }
  .grid-content {
    border-radius: 4px;
    min-height: 36px;
  }
  .row-bg {
    padding: 10px 0;
    background-color: #f9fafc;
  }
  
</style>
